package gamegui;

//import ButtonListener;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ViewMainMenu extends JPanel {
	/**Instantiate Main Menu Panel
	 * 
	 */
	Dimension dim = new Dimension (1100, 730);
	private final JButton mainBackButton,startGameButton,mapsButton, highScoresButton, optionsButton, creditsButton, helpButton;
	
	public ViewMainMenu(String username, int totalScoreOfUser){
		
		//Variables
	    Dimension buttonSize = new Dimension(165, 63);
	    Dimension exitSize = new Dimension(70, 70);
	    int firstRowY = 315;
	    int secondRowY = 395;
	    Point startLoc = new Point(536, firstRowY);
	    Point mapsLoc = new Point(717, firstRowY);
	    Point highScrLoc = new Point(898, firstRowY);
	    Point optionsLoc = new Point((int) startLoc.getX(), secondRowY);
	    Point creditsLoc = new Point((int) mapsLoc.getX(), secondRowY);
	    Point helpLoc = new Point((int) highScrLoc.getX(), secondRowY);
	    Point exitLoc = new Point(1014, 621);
	    
	    // Panel initialization
	   // JPanel mainPanel = new JPanel();
	    setLocation(0, 0);
	    
	    //Label
	    JLabel label = new JLabel();
	    ImageIcon mainImage = new ImageIcon("mainmenuscreen.jpg");    
	    label = new JLabel("", mainImage, JLabel.CENTER);
	    label.setLocation(0, 0);
	    label.setPreferredSize(dim);
	    
	    // Buttons
	    //Exit Button
	    mainBackButton = new JButton("Exit");
	    mainBackButton.setSize(exitSize);
	    mainBackButton.setLocation(exitLoc);
	    mainBackButton.setForeground(Color.red);
	    mainBackButton.setActionCommand("ExitToSignIn");
	    ImageIcon exitImg = new ImageIcon("biktim.jpg");    // exit image
	    JLabel exitLabel = new JLabel("", exitImg, JLabel.CENTER);
	    mainBackButton.add(exitLabel);
	   // mainBackButton.addActionListener(new ButtonListener());
	    
	    // Start Game Button
	    startGameButton = new JButton("Start Game");
	    startGameButton.setSize(buttonSize);
	    startGameButton.setLocation(536, 315);
	    //startGameButton.addActionListener(new ButtonListener());
	    label.add(startGameButton);
	    
	    // Maps Button
	    mapsButton = new JButton("Unlock Maps");
	    mapsButton.setSize(buttonSize);
	    mapsButton.setLocation(717, 315);
	    //mapsButton.addActionListener(new ButtonListener());
	    label.add(mapsButton);
	    
	    // High Scores Button
	    highScoresButton = new JButton("High Scores");
	    highScoresButton.setSize(buttonSize);
	    highScoresButton.setLocation(898, 315);
	    //highScoresButton.addActionListener(new ButtonListener());
	    label.add(highScoresButton);
	     
	    // Options Button
	    optionsButton = new JButton("Options");
	    optionsButton.setSize(buttonSize);
	    optionsButton.setLocation(536, 395);
	    //optionsButton.addActionListener(new ButtonListener());
	    label.add(optionsButton);
	    
	    // Credits Button
	    creditsButton = new JButton("Credits");
	    creditsButton.setSize(buttonSize);
	    creditsButton.setLocation(717, 395);
	    //creditsButton.addActionListener(new ButtonListener());
	    label.add(creditsButton);
	     
	    // Help Button
	    helpButton = new JButton("Help");
	    helpButton.setSize(buttonSize);
	    helpButton.setLocation(898, 395);
	    //helpButton.addActionListener(new ButtonListener());
	    label.add(helpButton);
	    
	    JLabel nameLabel = new JLabel(username);
	    nameLabel.setSize(buttonSize);
	    nameLabel.setLocation(900,70);
	    nameLabel.setForeground(new Color(255, 127, 80));
	    nameLabel.setFont(new Font("Sylfaen", Font.BOLD | Font.ITALIC, 24));
	    label.add(nameLabel);
	    
	    JLabel totalScoreLabel = new JLabel("Score: " + totalScoreOfUser);
	    totalScoreLabel.setSize(buttonSize);
	    totalScoreLabel.setLocation(950,100);
	    totalScoreLabel.setForeground(new Color(255, 127, 80));
	    totalScoreLabel.setFont(new Font("Sylfaen", Font.BOLD | Font.ITALIC, 24));
	    label.add(totalScoreLabel);
	    
	    label.add(mainBackButton);
	    add(label);
	    repaint();
	}
	//getters for buttons
	public JButton getMainBackButton() {
		return mainBackButton;
	}
	public JButton getStartGameButton() {
		return startGameButton;
	}
	public JButton getMapsButton() {
		return mapsButton;
	}
	public JButton getHighScoresButton() {
		return highScoresButton;
	}
	public JButton getOptionsButton() {
		return optionsButton;
	}
	public JButton getCreditsButton() {
		return creditsButton;
	}
	public JButton getHelpButton() {
		return helpButton;
	}
	
}
